package com.zlkj.pro.modular.app.controller;

import cn.stylefeng.roses.kernel.message.api.pojo.response.MessageResponse;
import cn.stylefeng.roses.kernel.message.db.entity.SysMessage;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import com.zlkj.pro.modular.business.model.vo.MessageVO;
import com.zlkj.pro.modular.business.service.MessageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.zlkj.pro.core.consts.ProjectConstants.SERVICE_APP_PREFIX;

/**
 * @author liyang
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@ApiResource(name = "消息", path = SERVICE_APP_PREFIX + "/message")
public class AppMessageController {

    private final MessageService messageService;

    @GetResource(name = "app消息列表", path = "/findList")
    public ResponseData findList(Long userId, Integer readFlag, String queryString) {
        List<MessageVO> restData = messageService.findList(userId, readFlag, queryString);
        return new SuccessResponseData(restData);
    }

    @GetResource(name = "app消息详情", path = "/detail")
    public ResponseData detail(Long messageId) {
        MessageResponse restData = messageService.detail(messageId);
        return new SuccessResponseData(restData);
    }

}
